//
//  WoEditVC.m
//  Dynamiclightvehicle
//
//  Created by 阮 沧晖 on 15/7/20.
//  Copyright (c) 2015年 阮 沧晖. All rights reserved.
//

#import "WoEditVC.h"

@interface WoEditVC ()
@property (weak, nonatomic) IBOutlet UITextField *contentTF;
@end

@implementation WoEditVC

- (void)viewDidLoad {
    NSLog(@"进入到---------->WoEditVC");
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self createUI];
    [self createData];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)createUI
{
    self.view.backgroundColor = RGB(245, 245, 245);
    self.automaticallyAdjustsScrollViewInsets = NO;
    self.navigationController.navigationBarHidden = YES;
    //自定义TAB BAR UI
    [self addNavigatorTitle:_editTitle parent:self.view];
    self.barViewControl.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"top_Background"]];
    [self AddLeftBtnAction:nil normal:@"top_返回" selected:@"top_返回" action:^{
        //[self dismissViewControllerAnimated:YES completion:nil];
        [self.navigationController popViewControllerAnimated:YES];
    }];
    
    __weak WoEditVC *weakSelf = self;
    [self AddRightBtnAction:@"完成" normal:nil selected:nil action:^{
        if (_resultBlock) {
            _resultBlock(weakSelf.contentTF.text);
        }
        [self.navigationController popViewControllerAnimated:YES];
    }];
    
   UITapGestureRecognizer* tapRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(textTFResignFirstResponder)];
    tapRecognizer.numberOfTapsRequired = 1;
    tapRecognizer.delegate = self;
    [self.view addGestureRecognizer:tapRecognizer];
    
}

-(void)createData
{
    _contentTF.text = _editValue;
    _contentTF.placeholder = _placeholderString;
}
-(void)textTFResignFirstResponder
{
    [_contentTF resignFirstResponder];
}
@end
